﻿namespace Guia.Elements
{
    using System.Windows.Automation;
    using Guia.Locator;

    /// <summary>
    /// This class represents a particular cell within a DataGrid.
    /// Attention: cells cant be looked up. They can only be accessed by the DataGrid directly. 
    /// </summary>
    public abstract class AbstractDataGridCell : UiElement
    {
        /// <summary>
        /// Initializes a new instance of the AbstractDataGridCell class. 
        /// </summary>
        /// <param name="automationElement">The AutomationElement representating the DataGridCell.</param>
        protected AbstractDataGridCell(AutomationElement automationElement)
            : base(automationElement)
        {
        }

        /// <summary>
        /// Gets the textual value of this cell.
        /// </summary>
        public string TextValue
        {
            get
            {
                return this.GetTextValue();
            }
        }

        /// <summary>
        /// Gets a textual value of this cell.
        /// </summary>
        /// <returns>String representation of this cell</returns>
        protected abstract string GetTextValue();
    }
}
